﻿Imports System.Transactions

Public Class Rsendemail

    Public Shared Function SendMail(ByVal wTo As String, ByVal wSubject As String, ByVal wBody As String) As Boolean
        '***** ENVIO DE EMAIL **********
        'Dim Cuenta As String  = System.Configuration.ConfigurationSettings.AppSettings["CuentaOrigen"]
        Dim correo As New System.Net.Mail.MailMessage
        correo.From = New System.Net.Mail.MailAddress("alerta@evolta.pe")
        Dim ArrTo = wTo.Split(";")
        For i = 0 To ArrTo.Length - 1
            If ArrTo(i).Trim <> "" Then
                correo.To.Add(ArrTo(i).Trim)
            End If
        Next
        correo.Subject = wSubject
        correo.Body = wBody
        correo.IsBodyHtml = True
        correo.Priority = System.Net.Mail.MailPriority.Normal
        Dim smtp As New System.Net.Mail.SmtpClient
        'smtp.Host = "mail.dominiotech.com.pe"
        'smtp.Credentials = New System.Net.NetworkCredential("usuario", "password")
        Dim wError As String
        Try
            smtp.Send(correo)
            wError = "Mensaje enviado satisfactoriamente"
        Catch ex As Exception
            wError = "ERROR: " & ex.Message
            Return False
        End Try
        Return True
    End Function

End Class
